<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="./css/normalize.css" />
		<link rel="stylesheet" type="text/css" href="./css/mui.min.css" />
	</head>

	<body>
		<div id="main"></div>
		<script src="./js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="./js/util/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="./js/require_2.3.5.js" id="require" data-baseurl="./" type="text/javascript" charset="utf-8"></script>
		<script src="./js/config/require_config.js" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">
			mui.init({
				preloadPages: [{
					url: "./pages/main.html",
					id: "main.html",
					styles: {}, //窗口参数
					extras: {}, //自定义扩展参数
					subpages: [{}, {}] //预加载页面的子页面
				}],
				preloadLimit: 5 //预加载窗口数量限制(一旦超出,先进先出)默认不限制
			});
			
			mui.plusReady(function() {
				require(["login", "storage","getui"], function(login, storage,getui) {
					getui.OnBindUser();
					getui.OnInit();
					//------------------------------自动登录
					var login_auto_login = storage.getItem("login_auto_login")
					if(login_auto_login == true) { //是自动登录
						var wt = plus.nativeUI.showWaiting(null, {
							back: "none"
						});
						var b = login.OnAccessToken(function(data) { //成功
							wt.close();
							//直接跳转到首页	
							console.log("登录成功")
							OnShowLogin();
//							OnOpenWindow("./pages/main.html","main.html")
						}, function() { //失败
							wt.close();
							console.log("网络异常")
							OnShowLogin();
						});
					} else { //非自动登录
						OnShowLogin();
					}
					//-------------------------------end
				});
			});

			function OnShowLogin() {
				var oneget = localStorage.getItem("oneget");
				if(!!oneget && oneget == "getone") {
					mui.openWindow({
						url: './pages/login/login.html',
						id: 'login.html',
						show: {
							autoShow: true, //页面loaded事件发生后自动显示，默认为true
							aniShow: "fade-in", //页面显示动画，默认为”slide-in-right“；
						},
					})
				} else {
					mui.openWindow({
						url: './pages/load/load.html',
						id: 'load.html',
						show: {
							autoShow: true, //页面loaded事件发生后自动显示，默认为true
							aniShow: "fade-in", //页面显示动画，默认为”slide-in-right“；
						},
					})
				}
			}
		</script>
	</body>

</html>